Forth (programming language)

Forth
Paradigmconcatenative (stack-based), procedural, reflective
Designed byCharles H. Moore
First appeared1970 (1970)
Typing disciplineTypeless
Filename extensions.fs, .fth, .4th, .f, .forth[citation needed]
Websiteforth-standard.org
Major implementations
SwiftForth (Forth, Inc.)
Gforth (GNU Project)
VFX Forth (MicroProcessor Engineering)
Influenced
Bitcoin Script, Factor, Joy, RPL, Rebol, STOIC

Forth is a stack-oriented programming language and interactive integrated development environment designed by Charles H. "Chuck" Moore and first used by other programmers in 1970. Although not an acronym, the language's name in its early years was often spelled in all capital letters as FORTH. The FORTH-79 and FORTH-83 implementations, which were not written by Moore, became de facto standards, and an official technical standard of the language was published in 1994 as ANS Forth. A wide range of Forth derivatives existed before and after ANS Forth. The free and open-source software Gforth implementation is actively maintained, as are several commercially supported systems.

Forth typically combines a compiler with an integrated command shell,[a] where the user interacts via subroutines called words. Words can be defined, tested, redefined, and debugged without recompiling or restarting the whole program. All syntactic elements, including variables, operators, and control flow, are defined as words. A stack is used to pass parameters between words, leading to a Reverse Polish Notation style.

For much of Forth's existence, the standard technique was to compile to threaded code, which can be interpreted faster than bytecode. One of the early benefits of Forth was size: an entire development environment—including compiler, editor, and user programs—could fit in memory on an 8-bit or similarly limited system. No longer constrained by space, there are modern implementations that generate optimized machine code like other language compilers. The relative simplicity of creating a basic Forth system has led to many personal and proprietary variants, such as the custom Forth used to implement the bestselling 1986 video game Starflight from Electronic Arts.[1]

Forth is used in the Open Firmware boot loader, in spaceflight applications[2] such as the Philae spacecraft,[3][4] and in other embedded systems which involve interaction with hardware.

Moore developed a series of microprocessors for executing compiled Forth-like code directly and experimented with smaller languages based on Forth concepts, including cmForth and colorForth. Most of these languages were designed to support Moore's own projects, such as chip design.


Cite error: There are <ref group=lower-alpha> tags or {{efn}} templates on this page, but the references will not show without a {{reflist|group=lower-alpha}} template or {{notelist}} template (see the help page).

  1. ^ Maher, Jimmy (October 28, 2014). "Starflight". The Digital Antiquarian. Retrieved April 29, 2023.
  2. ^ NASA applications of Forth (original NASA server no longer running, copy from archive.org)
  3. ^ "Intersil's RTX processors and Forth software controlled the successful Philae landing" (PDF). MicroProcessor Engineering Limited. October 13, 2014. Retrieved April 29, 2023.
  4. ^ "Here comes Philae! Powered by an RTX2010". The CPU Shack Museum. October 12, 2014. Retrieved April 29, 2023.

Developed by StudentB